import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import electron from 'vite-plugin-electron';
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';

export default defineConfig({
	plugins: [
		vue(),
		electron([
			{
				// 主进程配置
				entry: 'electron/main.ts',
			},
			{
				// 预加载脚本配置
				entry: 'electron/preload.ts',
			},
		]),
		AutoImport({
			resolvers: [ElementPlusResolver()],
		}),
		Components({
			resolvers: [ElementPlusResolver()],
		}),
	],
	base: './', // 设置基础路径，确保静态资源在Electron中正确加载
	// 配置代理，解决跨域问题
});
